﻿namespace TSL.Utility
{
    using System;
    using System.Web;
    internal class PageHandler : IHttpHandler
    {
        private string m_Assembly;
        private string m_HandlerUri;
        private Request m_Request;

        internal PageHandler()
        {
        }

        public virtual void ProcessRequest(HttpContext context)
        {
        }

        public void Write(string text)
        {
            if (HttpContext.Current == null)
            {
                throw new NullReferenceException("没有找到相应方法.");
            }
            HttpContext.Current.Response.Write(text);
        }

        public void WriteLine(string line)
        {
            this.Write(line);
            this.Write("\r\n");
        }

        public string Assembly
        {
            get
            {
                return this.m_Assembly;
            }
            set
            {
                this.m_Assembly = value;
            }
        }

        public string HandlerUri
        {
            get
            {
                return this.m_HandlerUri;
            }
            set
            {
                this.m_HandlerUri = value;
            }
        }

        public virtual bool IsReusable
        {
            get
            {
                return true;
            }
        }

        public Request Request
        {
            get
            {
                return this.m_Request;
            }
            set
            {
                this.m_Request = value;
            }
        }
    }
}
